Variable Shunting for the WAM

نویسندگان

  • Dan Sahlin
  • Mats Carlsson
چکیده

This paper describes how to extend the garbage collection for WAM [ACHS88] so that it will shunt chains of bound variables if possible. Doing so has two advantages: 1. Space is saved by making it possible to deallocate the intermediate cells. This is particularly useful when those cells are associated with frozen goals. 2. Later dereferencing is speeded up by not having to follow long variable chains. The main complication of this optimization is the treatment of the trailed variables. We claim that all possible chains of variables are shunted by this algorithm. The algorithm has been implemented in SICStus Prolog, and benchmark results are presented in this paper. This paper is a revised version of [Sahlin89] and is meant to be read in conjunction with [ACHS88] as the notation used is presented there and only briefly summarized here. The full source code for the shunting algorithm is given in this paper. An example Chains of variables are unavoidable in an ordinary WAM execution. For instance, the query p(1000,s(A),B) given to the program below, will create a variable chain starting in B having 1000 links. p(0,s(Z),Z). p(N,s(X),Z) :N>0, N1 is N-1, p(N1,Y,Z), Y=s(X). During WAM execution a number of value cells containing various instances of s(X) will be created first. Then the chain of X's will be linked so that the last one will point to the next to last, the next to last will point to the third from the end, etc. Thus these variable chains may occur in normal WAM execution. If these intermediate cells are “short-circuited” (shunted), subsequent dereferencing of the variable B in the query will not have to traverse the intermediate cells. Thus execution speed is improved. If the intermediate cells are not referenced from anywhere else, they may also become deallocated. Thus more storage can be reclaimed.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Success rates and complications of ventriculoperitoneal and ventriculoatrial shunting: A systematic review

Background and Aims: The insertion of ventriculoperitoneal (VP) and ventriculoatrial (VA) shunts is the first-line treatment of patients with hydrocephalus and normal-pressure hydrocephalus. The provision of a safety profile for shunting in the treatment of hydrocephalus patients is very important. This study aimed to determine the success rates and complications of VP and VA shunting in patien...

متن کامل

Variable Ages In A WAM Based System

We present a new method to represent variable bindings in the Warren Abstract Machine WAM so that ages of variable bindings can be easily found using this new representation The age of a variable bound to a ground term will be the youngest choice point such that backtracking to that choice point can make that variable an unbound variable again In other words the age of a variable bound to a gro...

متن کامل

Suspension Frames on the WAM Heap

A suspension encapsulates everything needed to execute a piece of code many times in the same context: the need for this feature exists in constraint solver programming, where (part of) a predicate checking the satisfiability of a set of a constraints needs to be re-executed every time the domain of a concerned variable changes. Traditional extensions of the WAM support a heap term and metacall...

متن کامل

Comparison of failure between post- shunted ETV and primary ETV in hydrocephalus: a review article

Hydrocephalus is an abnormal increase in the volume of cerebrospinal fluid (CSF), and sometimes increased intracerebral pressure also leads to hydrocephalus. Endoscopic Third Ventriculostomy (ETV) treatment is a new method for hydrocephaly treatment. In this method, in addition to the fact that the patient does not need an implant, the risk of infection is low and in the long term the result is...

متن کامل

Trailing Analysis for HAL

The HAL language includes a Herbrand constraint solver which uses Taylor’s PARMA scheme rather than the standard WAM representation. This allows HAL to generate more efficient Mercury code. Unfortunately, PARMA’s variable representation requires value trailing with a trail stack consumption about twice as large as for the WAM. We present a trailing analysis aimed at determining which Herbrand v...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1991